home *** CD-ROM | disk | FTP | other *** search
- <?xml version="1.0" encoding="utf-8" ?>
- <!DOCTYPE background PUBLIC "-//Apple, Inc.//DTD background V 2.0//EN" "" >
- <background>
- <id>3763</id>
- <filler1>0</filler1>
- <bitmap>BMAP_4463.pbm</bitmap>
- <cantDelete> <false /> </cantDelete>
- <showPict> <true /> </showPict>
- <dontSearch> <false /> </dontSearch>
- <link rel="stylesheet" type="text/css" href="stylesheet_3098.css" />
- <part>
- <id>1</id>
- <type>field</type>
- <visible> <true /> </visible>
- <dontWrap> <false /> </dontWrap>
- <dontSearch> <false /> </dontSearch>
- <sharedText> <false /> </sharedText>
- <fixedLineHeight> <false /> </fixedLineHeight>
- <autoTab> <false /> </autoTab>
- <lockText> <false /> </lockText>
- <rect>
- <left>75</left>
- <top>2</top>
- <right>187</right>
- <bottom>18</bottom>
- </rect>
- <style>rectangle</style>
- <autoSelect> <false /> </autoSelect>
- <showLines> <false /> </showLines>
- <wideMargins> <false /> </wideMargins>
- <multipleLines> <false /> </multipleLines>
- <reservedFamily> 0 </reservedFamily>
- <titleWidth>0</titleWidth>
- <icon>0</icon>
- <textAlign>left</textAlign>
- <font>Geneva</font>
- <textSize>9</textSize>
- <textStyle>plain</textStyle>
- <textHeight>12</textHeight>
- <name>FileName</name>
- <script></script>
- </part>
- <part>
- <id>2</id>
- <type>field</type>
- <visible> <true /> </visible>
- <dontWrap> <false /> </dontWrap>
- <dontSearch> <false /> </dontSearch>
- <sharedText> <false /> </sharedText>
- <fixedLineHeight> <false /> </fixedLineHeight>
- <autoTab> <false /> </autoTab>
- <lockText> <false /> </lockText>
- <rect>
- <left>250</left>
- <top>2</top>
- <right>411</right>
- <bottom>18</bottom>
- </rect>
- <style>rectangle</style>
- <autoSelect> <false /> </autoSelect>
- <showLines> <false /> </showLines>
- <wideMargins> <false /> </wideMargins>
- <multipleLines> <false /> </multipleLines>
- <reservedFamily> 0 </reservedFamily>
- <titleWidth>0</titleWidth>
- <icon>0</icon>
- <textAlign>left</textAlign>
- <font>Geneva</font>
- <textSize>9</textSize>
- <textStyle>plain</textStyle>
- <textHeight>12</textHeight>
- <name>Returns</name>
- <script></script>
- </part>
- <part>
- <id>3</id>
- <type>field</type>
- <visible> <true /> </visible>
- <dontWrap> <false /> </dontWrap>
- <dontSearch> <false /> </dontSearch>
- <sharedText> <false /> </sharedText>
- <fixedLineHeight> <false /> </fixedLineHeight>
- <autoTab> <false /> </autoTab>
- <lockText> <false /> </lockText>
- <rect>
- <left>75</left>
- <top>21</top>
- <right>411</right>
- <bottom>73</bottom>
- </rect>
- <style>scrolling</style>
- <autoSelect> <false /> </autoSelect>
- <showLines> <false /> </showLines>
- <wideMargins> <false /> </wideMargins>
- <multipleLines> <false /> </multipleLines>
- <reservedFamily> 0 </reservedFamily>
- <titleWidth>0</titleWidth>
- <icon>0</icon>
- <textAlign>left</textAlign>
- <font>Geneva</font>
- <textSize>9</textSize>
- <textStyle>plain</textStyle>
- <textHeight>12</textHeight>
- <name>Prototype</name>
- <script></script>
- </part>
- <part>
- <id>4</id>
- <type>button</type>
- <visible> <true /> </visible>
- <reserved5> 0 </reserved5>
- <reserved4> 0 </reserved4>
- <reserved3> 0 </reserved3>
- <reserved2> 0 </reserved2>
- <reserved1> 0 </reserved1>
- <enabled> <true /> </enabled>
- <rect>
- <left>382</left>
- <top>217</top>
- <right>416</right>
- <bottom>240</bottom>
- </rect>
- <style>transparent</style>
- <showName> <false /> </showName>
- <highlight> <false /> </highlight>
- <autoHighlight> <true /> </autoHighlight>
- <sharedHighlight> <true /> </sharedHighlight>
- <family>0</family>
- <titleWidth>0</titleWidth>
- <icon>1013</icon>
- <textAlign>center</textAlign>
- <font>Chicago</font>
- <textSize>12</textSize>
- <textStyle>plain</textStyle>
- <name>Next</name>
- <script>on mouseUp
- go to next card
- end mouseUp</script>
- </part>
- <part>
- <id>5</id>
- <type>button</type>
- <visible> <true /> </visible>
- <reserved5> 0 </reserved5>
- <reserved4> 0 </reserved4>
- <reserved3> 0 </reserved3>
- <reserved2> 0 </reserved2>
- <reserved1> 0 </reserved1>
- <enabled> <true /> </enabled>
- <rect>
- <left>0</left>
- <top>216</top>
- <right>25</right>
- <bottom>240</bottom>
- </rect>
- <style>transparent</style>
- <showName> <false /> </showName>
- <highlight> <false /> </highlight>
- <autoHighlight> <true /> </autoHighlight>
- <sharedHighlight> <true /> </sharedHighlight>
- <family>0</family>
- <titleWidth>0</titleWidth>
- <icon>1014</icon>
- <textAlign>center</textAlign>
- <font>Chicago</font>
- <textSize>12</textSize>
- <textStyle>plain</textStyle>
- <name>Prev</name>
- <script>on mouseUp
- go to previous card
- end mouseUp</script>
- </part>
- <part>
- <id>6</id>
- <type>button</type>
- <visible> <true /> </visible>
- <reserved5> 0 </reserved5>
- <reserved4> 0 </reserved4>
- <reserved3> 0 </reserved3>
- <reserved2> 0 </reserved2>
- <reserved1> 0 </reserved1>
- <enabled> <true /> </enabled>
- <rect>
- <left>34</left>
- <top>218</top>
- <right>193</right>
- <bottom>237</bottom>
- </rect>
- <style>shadow</style>
- <showName> <true /> </showName>
- <highlight> <false /> </highlight>
- <autoHighlight> <true /> </autoHighlight>
- <sharedHighlight> <true /> </sharedHighlight>
- <family>0</family>
- <titleWidth>0</titleWidth>
- <icon>0</icon>
- <textAlign>center</textAlign>
- <font>Chicago</font>
- <textSize>12</textSize>
- <textStyle>plain</textStyle>
- <name>Read Header Files</name>
- <script>on mouseUp
- put false into multi
- put 0 into fileNumber
-
- answer "Shall I go straight on and export the data after I’ve read it in?" ¬
- with "Yes", "No"
- if it is "Yes" then
- put true into batchMode
- else
- put false into batchMode
- end if
-
- answer "Parse one file or the list from a folder?" with "Cancel",¬
- "Many", "One"
-
- if it is "Cancel" then exit mouseUp
-
- if it is "One" then
- answer file "C header file to parse:" of type "TEXT"
- if it is empty then exit mouseUp
- put it into fileName
- -- this function is in home and strips off the path
- put lastHCItem(":", fileName) into shortFileName
- put getPath(fileName) into path
-
- end if
-
- if it is "Many" then
- put true into multi
- put 1 into fileNumber
- answer file "Open any file in the source folder:" of type "TEXT"
- if it is empty then exit mouseUp
- put it into fileName
- -- this gets the path from the pull file and path
- put getPath(fileName) into path
- put files(path) into background fld "Files"
- put background fld "files" into fileList
-
- end if
-
- repeat
-
- if multi then
- -- get the next file name from the list
- put line fileNumber of fileList into fileName
-
- if fileName is empty then
- if batchMode then
- doExport "New TextBase"
- end if
- beep
- beep
- beep
- exit mouseUp
- end if
-
- put fileName into shortFileName
- put path before fileName
- put fileNumber + 1 into fileNumber
- end if
-
- open file fileName
- put "Reading file number: " & fileNumber -1 & " “" &fileName & "”…"
- read from file fileName until return
-
- go to the last card of background "Protos"
-
- repeat while it is not empty
- put it into line
- set cursor to busy
-
- if isCfunction(line) then
- -- collect the function
- put offset(")", line) into closeBracketAt
- -- test for multi-line functions
- if closeBracketAt is 0 then
- read from file fileName until ")"
- put line & it & ";" into funcLine
- else
- -- handle single line function prototypes
- put character 1 to closeBracketAt of line & ";" into funcLine
- end if
-
- -- replaces tabs with spaces
- put stripTabs(funcLine) into funcLine
-
- -- remove the return types
- put offset("(", funcLine) into openBracketAt
- if openBracketAt is not zero then
-
- -- scan back over spaces to find the function name
- repeat with i = openBracketAt down to 1
- if character i of funcLine is not space then exit repeat
- end repeat
-
- -- scan back until we find the space before the function name
- repeat with i = i - 3 down to 1
- if character i of funcLine is space then exit repeat
- end repeat
-
- put character 1 to i of funcLine into returnType
- delete character 1 to i of funcLine
- end if
-
- -- now prepare to put the information in a card
- doMenu "New Card"
- put shortFileName into background field "FileName"
-
- if word 1 of returnType is "pascal" then
- delete word 1 of returnType
- end if
- if word 1 of returnType is empty then
- put "void" into returnType
- end if
-
- put returnType into background field "Returns"
-
- -- strip off leading spaces
- repeat with i = 1 to the number of chars in funcLine
- if character 1 of funcLine is space or ¬
- character 1 of funcLine is tab then
- delete character 1 of funcLine
- else
- exit repeat
- end if
- end repeat
-
- -- this gets rid of the carriage returns in the text
- repeat with i = 1 to the number of words in funcLine
- put word i of funcLine & space after background field "ProtoType"
- end repeat
-
- end if
- read from file fileName until return
- end repeat -- no more lines to read
- if not multi then
- close file fileName
- hide msg
- exit mouseUp
- end if
- close file fileName
- end repeat -- reading multi files
- end mouseUp
-
- -- This should be improved but works well enough for the MPW headers
- function isCfunction line
- if word 1 of line is "pascal" then
- return true
- else
- return false
- end if
- end isCfunction
-
- -- replaces tabs with spaces
- function stripTabs line
- repeat with i = 1 to the number of characters in line
- if character i of line is tab then
- put space into character i of line
- end if
- end repeat
- return line
- end stripTabs
-
- -- pinched from Home for completeness
- function lastHCItem delim,theText
- -- returns the portion of <theText> that follows the last <delim>
- if delim is in theText then
- put lastHCItem(delim,char offset(delim,theText) + 1 to ¬
- length(theText) of theText) into theText
- end if
- return theText
- end lastHCItem
-
- function getPath theText
- -- returns the portion of <theText> up to the last <delim>
- repeat with i = the number of chars in theText down to 1
- if character i of theText is ":" then exit repeat
- end repeat
- return character 1 to i of theText
- end getPath
-
- -- This sorts the cards by the function name
- -- outputs the text to a file with the words wrapped at the
- -- first word break after 65 characters are counted
- -- output is: functionName(parameters); // type fileName.h
- -- By: Peter Marks Access Informatics (02) 555 8414
-
- on doExport fileName
- sort by field "ProtoType"
- put "Sorting the stack, please wait…" into msg
-
- open file fileName
- write "=" to file fileName
- repeat with i = 1 to the number of cards in this stack
- go to card i
- set cursor to busy
- put background fld "Prototype" & " // " & ¬
- background fld "returns" & ¬
- " <" & background fld "fileName" & ">|" into outLine
-
- -- write out the text, wrapping at the first word after 61 chars wide
- put false into break
- repeat with j = 1 to the number of characters in outline
- if break and character j of outline is space then
- write return to file fileName
- put false into break
- end if
- write character j of outline to file fileName
- if j mod 61 is zero then
- put true into break -- break when you can!
- set cursor to busy
- end if
- end repeat
- write return to file fileName
-
- end repeat
- write "=" to file fileName
- close file fileName
- beep
- end doExport</script>
- </part>
- <part>
- <id>7</id>
- <type>field</type>
- <visible> <true /> </visible>
- <dontWrap> <false /> </dontWrap>
- <dontSearch> <false /> </dontSearch>
- <sharedText> <false /> </sharedText>
- <fixedLineHeight> <false /> </fixedLineHeight>
- <autoTab> <false /> </autoTab>
- <lockText> <true /> </lockText>
- <rect>
- <left>85</left>
- <top>139</top>
- <right>217</right>
- <bottom>203</bottom>
- </rect>
- <style>scrolling</style>
- <autoSelect> <false /> </autoSelect>
- <showLines> <false /> </showLines>
- <wideMargins> <false /> </wideMargins>
- <multipleLines> <false /> </multipleLines>
- <reservedFamily> 0 </reservedFamily>
- <titleWidth>0</titleWidth>
- <icon>0</icon>
- <textAlign>left</textAlign>
- <font>Geneva</font>
- <textSize>9</textSize>
- <textStyle>plain</textStyle>
- <textHeight>12</textHeight>
- <name>Files</name>
- <script></script>
- </part>
- <part>
- <id>8</id>
- <type>button</type>
- <visible> <true /> </visible>
- <reserved5> 0 </reserved5>
- <reserved4> 0 </reserved4>
- <reserved3> 0 </reserved3>
- <reserved2> 0 </reserved2>
- <reserved1> 0 </reserved1>
- <enabled> <true /> </enabled>
- <rect>
- <left>2</left>
- <top>180</top>
- <right>82</right>
- <bottom>202</bottom>
- </rect>
- <style>shadow</style>
- <showName> <true /> </showName>
- <highlight> <false /> </highlight>
- <autoHighlight> <true /> </autoHighlight>
- <sharedHighlight> <true /> </sharedHighlight>
- <family>0</family>
- <titleWidth>0</titleWidth>
- <icon>0</icon>
- <textAlign>center</textAlign>
- <font>Geneva</font>
- <textSize>9</textSize>
- <textStyle>plain</textStyle>
- <name>Delete Cards</name>
- <script>on mouseUp
- answer "Do you want to delete all data from this stack?" with ¬
- "Yes", "Cancel"
- if it is "Cancel" then exit mouseUp
-
- repeat with i = 2 to the number of cards in this stack
- go to card 2
- doMenu "Delete Card"
- set cursor to busy
- end repeat
- end mouseUp</script>
- </part>
- <part>
- <id>9</id>
- <type>button</type>
- <visible> <true /> </visible>
- <reserved5> 0 </reserved5>
- <reserved4> 0 </reserved4>
- <reserved3> 0 </reserved3>
- <reserved2> 0 </reserved2>
- <reserved1> 0 </reserved1>
- <enabled> <true /> </enabled>
- <rect>
- <left>199</left>
- <top>218</top>
- <right>379</right>
- <bottom>237</bottom>
- </rect>
- <style>shadow</style>
- <showName> <true /> </showName>
- <highlight> <false /> </highlight>
- <autoHighlight> <true /> </autoHighlight>
- <sharedHighlight> <true /> </sharedHighlight>
- <family>0</family>
- <titleWidth>0</titleWidth>
- <icon>0</icon>
- <textAlign>center</textAlign>
- <font>Chicago</font>
- <textSize>12</textSize>
- <textStyle>plain</textStyle>
- <name>Export To OnBase</name>
- <script>-- This sorts the cards by the function name
- -- outputs the text to a file with the words wrapped at the
- -- first word break after 65 characters are counted
- -- output is: functionName(parameters); // type fileName.h
- -- By: Peter Marks Access Informatics (02) 555 8414
-
- on mouseUp
- ask file "Name your export file:" with "TextBase"
- if it is empty then exit mouseUp
- put it into fileName
- sort by field "ProtoType"
- put "Sorting the stack, please wait…" into msg
-
- open file fileName
- write "=" to file fileName
- repeat with i = 2 to the number of cards in this stack
- go to card i
- set cursor to busy
- put background fld "Prototype" & " // " & ¬
- background fld "returns" & ¬
- " <" & background fld "fileName" & ">|" into outLine
-
- -- write out the text, wrapping at the first word after 61 chars wide
- put false into break
- repeat with j = 1 to the number of characters in outline
- if break and character j of outline is space then
- write return to file fileName
- put false into break
- end if
- write character j of outline to file fileName
- if j mod 61 is zero then
- put true into break -- break when you can!
- set cursor to busy
- end if
- end repeat
- write return to file fileName
-
- end repeat
- write "=" to file fileName
- close file fileName
- beep
- end mouseUp</script>
- </part>
- <name>Protos</name>
- <script></script>
- </background>
-